<?php
class Photo_model extends CI_Model
{
	public function getImgByProId($name)
	{	$data = array();
		$this->db->select('ph.img');
		$this->db->from('photo ph');
		$this->db->where('p.name',$name);
		$this->db->where('ph.public','1');
		$this->db->order_by('ph.order');
		$this->db->join('products p','p.id = ph.product_id');
		/*$q = $this->db->get_where('photo',array('product_id'=>$id , 'public'=>'1'));*/
		$q = $this->db->get();
		if($q -> num_rows()){
		$data = $q->result_array();
		}
		$q -> free_result();
		return $data;
	}
}